#include "raylib.h"

int main(void)
{
    const int screenWidth = 800;
    const int screenHeight = 450;
    
    InitWindow(screenWidth, screenHeight, "Simple Filled Triangle");
    
    SetTargetFPS(60);
    Vector2 ps[] = {
        Vector2{400,300},
        Vector2{300,300},
        Vector2{100,350},
        Vector2{450,350},
        Vector2{450,100},
        Vector2{400,250},
        Vector2{300,250},
        Vector2{300,300},
    };
    
    while (!WindowShouldClose())
    {
        BeginDrawing();
        ClearBackground(RAYWHITE);

        Vector2 curser = GetMousePosition();
        
        // ps[0] = curser;
        
        

        // 绘制填充三角形
        DrawTriangleFan(ps,8,RED);
        // DrawTriangle(ps[6-2],ps[6-1],ps[6],RED);
        
        DrawText("Simple Filled Triangle", 10, 10, 20, DARKGRAY);

        for(int i =0 ; i < 8; i++)
        for(int j =0; j< 8; j++)
        {
            DrawCircle(100 + i*50, 100 + j*50, 5, GREEN);
        }
        
        EndDrawing();
    }
    
    CloseWindow();
    
    return 0;
}